{% extends "base.html" %}

{% autoescape off %} {% block title %}| Lista de Trofeus - {{game.name}}{% endblock %} {% endautoescape %} {% block body %} {% autoescape off %} <br/><center>Trofeus - <b>{{game.name}}</b><br/></center><br/> {% endautoescape %}
{% if size %}
<table align=center>
		<th colspan={{size}} height=30><h2> Conquistas dos usuarios </h2></th>
		<tr>
		{% if user_list_have %}
		<th style="vertical-align:top" width=50> 
			<table align=center width=160>
				<th height=10 colspan=2> Tem o Jogo</th>
					{% for userHave in user_list_have %}
					<tr>
					<td align="left" style="border-right:0px"> <img class="meio" src="{{userHave.user.pic_url}}" height=20>
	            <a href= "/rank/{{ userHave.user.auth.username }}/game/{{game.psn_id}}"> {{ userHave.user.auth.username}} </a>
					</td>
					{% endfor %}
			</table>
		</th>
		{% endif %}
		{% if user_list_plat %}
		<th style="vertical-align:top" width=50> 
			<table align=center width=160>
				<th height=10> Platina </th>
					{% for userPlat in user_list_plat %}
					<tr>
					<td align="left" style="border-right:0px"> <img class="meio" src="{{userPlat.user.pic_url}}" height=20>
	            <a href= "/rank/{{ userPlat.user.auth.username }}/game/{{game.psn_id}}"> {{ userPlat.user.auth.username}} </a>
					</td>
					{% endfor %}
			</table>
		</th>

		{% endif %}
		{% if user_list_100 %}
		<th style="vertical-align:top" width=50> 
			<table align=center width=160>
				<th height=10 colspan=2> 100 % </th>
					{% for user100 in user_list_100 %}
					<tr>
					<td align="left" style="border-right:0px"> <img class="meio" src="{{user100.user.pic_url}}" height=20>
	            <a href= "/rank/{{ user100.user.auth.username }}/game/{{game.psn_id}}"> {{ user100.user.auth.username}} </a>
					</td>
					{% endfor %}
			</table>
		</th>
		{% endif %}

		</tr>
</table>
{% endif %}

<br/>

<table "sortable" align="center" height=35>
	<tr height=35> 
		<th align="center"  > Trofeu  </th>
		<th align="center"  > Detalhes </th>
		<th align="center"  > Tipo </th>
	</tr>
{% for trophy in trophy_list %}
	<tr> 
		<td> 
			<a href="http://www.youtube.com/results?search_query={{game.name}} trophy {{trophy.name}}"> </a> <br>
			{% ifequal trophy.pic_url '0' %}
				<img class="meio" src="/media/no_image.png" width=54 height=54/>
			{% else %}
				{% ifequal trophy.pic_url 'hidden.png' %}
					<img class="meio" src="/media/hidden-lock.png" width=54 height=54/>
				{% else %}
					<img class="meio" src="/media/game/{{ game.psn_id }}/{{trophy.pic_url}}" width=54 height=54/>
				{% endifequal %}
			{% endifequal %}
		</td>
		<td width=300>
			{% autoescape off %}
			<b><a href="/game/{{game.psn_id}}/{{ trophy.total_id }}"> {{trophy.name}} </a></b> <br/>
			{{ trophy.desc }}</td>
			{% endautoescape %}
		</td>
		<td align="center">
			<img src="/media/{{ trophy.type }}.png" width=20 height=20 />
		</td>
	</tr>


{% endfor %}
</table>
<br/>

{% load comments %}

<center>
<h2> Comentario so Usuarios </h2>
{% get_comment_list for game as comment_list %}
{% for comment in comment_list %}
	{{comment}} <br/>
{% endfor %}

{% if request.user.is_authenticated %}
<input name="author" id="id_name"  type="hidden" value="{{ user.auth.username }}" > </input>
<input name="email"  id="id_email" type="hidden" value="{{ user.auth.email }}" > </input>
<input name="url"    id="id_url"   type="hidden" value="{{ user.pic_url }}" > </input>
	<h3> Deixe o seu recado tb =D </h3>

{% get_comment_form for game as form %}

<table>
<form action="{% comment_form_target %}" method="post">{% csrf_token %}
  {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
  {% for field in form %}
    {% if field.is_hidden %}
      {{ field }}
    {% else %}
      {% if field.errors %}{{ field.errors }}{% endif %}
      <p
        {% if field.errors %} class="error"{% endif %}
        {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
        <tr><td width=200>{{ field.label_tag }}</td> <td width=400>{{ field }} </td> </tr>
      </p>
    {% endif %}
  {% endfor %}
</table>
  <p class="submit">
    <input type="submit" name="preview" class="submit-preview" value="Preview" />
    <input type="submit" name="preview" class="submit-post" value="Submit"></td>
  </p>
</form>



{% endif %}
</center>

{% endblock %}
